﻿using System.Collections.ObjectModel;
using System.Windows.Controls;
using Red.Controls.Shell;
using Database = Red.Launcher.ViewModels.Workspaces.Database;

namespace Red.Launcher.Dialogs
{
    public partial class UserList : RedWindow
    {
        #region Public Properties

        public ObservableCollection<Database.User> Users { get; private set; } = new ObservableCollection<Database.User>();

        #endregion Public Properties

        #region C-Tor

        public UserList()
        {
            InitializeComponent();
        }

        #endregion C-Tor

        #region Event Handlers

        /// <summary>
        /// Enables copying of user names from the table into the clipboard
        /// </summary>
        private void DataGrid_CopyingRowClipboardContent( object sender, DataGridRowClipboardEventArgs e )
        {
            const int NameColumn = 1;

            DataGridClipboardCellContent currentCell = e.ClipboardRowContent[ NameColumn ];

            e.ClipboardRowContent.Clear();
            e.ClipboardRowContent.Add( currentCell );
        }

        #endregion Event Handlers
    }
}
